<?php

namespace App\Http\Controllers;

use App\Wen;
use Illuminate\Http\Request;

class WenController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function add(Request $request)
    {
        $this->validate($request,[
            'name'=>'required',
            'jian'=>'required',
            'zname'=>'required',
            'znei'=>'required',
            'zid'=>'required',
            'dian'=>'required',
        ]);
        $data=Wen::Adds($request);
        if($data)
        {
            redirect('wen.show');
        }
        else{
            redirect('wen.add');
        }
    }
    public function show()
    {
        $data=Wen::Shows($request);
        return view('wen.show',['arr'=>$data]);
    }
    public function del(Request $request)
    {
        $id=$request['id'];
        $data=Wen::Dels($request);
        if($data)
        {
            redirect('show');
        }
        else{
            redirect('show');
        }
    }
    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  \App\Wen  $wen
     * @return \Illuminate\Http\Response
     */
    public function show(Wen $wen)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  \App\Wen  $wen
     * @return \Illuminate\Http\Response
     */
    public function edit(Wen $wen)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Wen  $wen
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, Wen $wen)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  \App\Wen  $wen
     * @return \Illuminate\Http\Response
     */
    public function destroy(Wen $wen)
    {
        //
    }
}
